package com.tencent.sr.iris.basic.saas.service.model.advisor;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.tencent.sr.iris.activity.interfaces.response.group.AdvisorBoardCommissionThirdResponse;
import com.tencent.sr.iris.basic.saas.common.enums.IrisOrderStatusEnum;
import com.tencent.sr.iris.basic.saas.common.enums.IrisTaskProfitStatusEnum;
import com.tencent.sr.iris.basic.saas.common.utils.CommonUtils;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Data
@ApiModel(value = "团长任务列表-佣金回滚导出信息")
@Slf4j
@ColumnWidth(15)
public class AdvisorThirdCommissionExportInfo {

    @ExcelProperty(value = "序号", index = 0)
    private int num;

    @ExcelProperty(value = "收益状态", index = 1)
    private String commissionStatus;

    @ExcelProperty(value = "uid", index = 2)
    private String irisUid;

    @ExcelProperty(value = "unionId", index = 3)
    private String wechatUserUnionid;

    @ExcelProperty(value = "昵称", index = 4)
    private String wechatUserNickname;

    @ExcelProperty(value = "支付时间", index = 5)
    private String thirdPartOrderCreateTime;

    @ExcelProperty(value = "订单编号", index = 6)
    private String plainOrderId;

    @ExcelProperty(value = "订单状态", index = 7)
    private String orderStatus;

    @ExcelProperty(value = "订单金额", index = 8)
    private Double thirdPartOrderPrice;

    @ExcelProperty(value = "预估奖励佣金", index = 9)
    private Double predictCommissionFee;

    @ExcelProperty(value = "实际奖励佣金", index = 10)
    private Double commissionFee;

    @ExcelProperty(value = "预估佣金总额", index = 11)
    private Double predictCommissionTotalFee;


    public void readFromSearchResponseData(AdvisorBoardCommissionThirdResponse response) {
        this.setIrisUid(response.getIrisUid());
        this.setWechatUserUnionid(response.getWechatUserUnionid());
        this.setWechatUserNickname(response.getWechatUserNickname());
        this.setThirdPartOrderCreateTime(response.getThirdPartOrderCreateTime());

        this.setOrderStatus(IrisOrderStatusEnum.getByStatus(response.getOrderStatus()));

        this.setThirdPartOrderPrice(CommonUtils.longToDouble(response.getThirdPartOrderPrice()));
        this.setPlainOrderId(response.getPlainOrderId());
        this.setCommissionStatus(IrisTaskProfitStatusEnum.getByStatus(response.getCommissionStatus()));

        setPredictCommissionFee(CommonUtils.longToDouble(response.getPredictCompensateCommissionFee()));

        setPredictCommissionTotalFee(CommonUtils.longToDouble(response.getPredictCommissionTotalFee()));

        setCommissionFee(CommonUtils.longToDouble(response.getCompensateCommissionFee()));

    }


}
